<template>
  <div>
    <span>v-model</span>
    <input v-model="inputVal" />

    <span>语法糖分解</span>
    <input v-bind:value="inputVal" @input="inputHandler" />
    <my-button @click="inputVal = '测试'"> 设置输入框的值为：测试 </my-button>
    {{ inputVal }}
  </div>
</template>

<script>
import myButton from "../lesson7/my-button.vue";
export default {
  components: { myButton },
  data() {
    return {
      inputVal: "",
    };
  },
  methods: {
    inputHandler(event) {
      console.log(event);
      this.inputVal = event.target.value;
    },
  },
};
</script>

<style>
</style>